package com.jindi.jacococli.biz.business.queue;

import com.google.common.collect.Lists;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Getter
@Setter
public class JacocoCliEvent {

    // 工作空间 + 服务名
    private String workSpace;

    private String serviceName;

    private String uuid;

    private List<Node> nodes;

    public JacocoCliEvent(String workSpace, String serviceName) {
        this.workSpace = workSpace;
        this.serviceName = serviceName;
    }

    public void addNode(Node node) {
        if (this.nodes == null) {
            nodes = Lists.newArrayList();
        }
        nodes.add(node);
    }

    @Getter
    @Setter
    public static class Node {
        private String ip;
        private Integer port;

        public Node(String ip, Integer port) {
            this.ip = ip;
            this.port = port;
        }
    }
}
